using System.Resources;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;

namespace PcrExperimentProject
{
	public class ShowCrossTalkGridTextInRowSelect : IUIElementCreationFilter
	{
		private ResourceManager mResourceManager;

		public ShowCrossTalkGridTextInRowSelect(ResourceManager resourceManager)
		{
			mResourceManager = resourceManager;
		}

		public void AfterCreateChildElements(UIElement parent)
		{
			TextUIElement textUIElement = parent as TextUIElement;
			UIElement uIElement = parent.GetAncestor(typeof(RowSelectorUIElement)) as RowSelectorUIElement;
			UltraGridRow ultraGridRow = parent.GetContext(typeof(UltraGridRow)) as UltraGridRow;
			if (textUIElement != null && uIElement != null && ultraGridRow != null)
			{
				textUIElement.Text = mResourceManager.GetString("ChannelString") + " " + (ultraGridRow.Index + 1);
				textUIElement.TextHAlign = HAlign.Center;
				textUIElement.TextVAlign = VAlign.Middle;
				ultraGridRow.Height = 22;
			}
		}

		public bool BeforeCreateChildElements(UIElement parent)
		{
			return false;
		}
	}
}
